/**
 * This file is part of the CAKIS project.
 * 
 * Copyright (c) 2009-2010 - Florian Arndt, Christian Kerl
 * 
 * @license GNU Lesser General Public License v3 <http://www.opensource.org/licenses/lgpl-3.0.html>
 * @since   04.05.2010
 * @version SVN: $Id: ProductExistForm.java 111 2010-05-07 10:50:22Z f.aarndt@web.de $
 */

package org.cakis.client.forms;

import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;

import org.cakis.client.CakisMIDlet;
import org.cakis.client.commands.AddProductCommand;
import org.cakis.client.commands.DeleteProductCommand;
import org.cakis.client.commands.ResumeCommand;
import org.cakis.webservice.Product;

/**
 * ProductExistForm
 *
 * @author Florian Arndt
 */
public class ProductExistForm extends AbstractForm {
	private StringItem productLabel;
	private TextField inputField;
	private Product product;

	public ProductExistForm(CakisMIDlet midlet, Product product, 
			boolean offlineScannedBarcodes) {
		super("Eingabefenster", midlet);
		this.product = product;
		productLabel = new StringItem("Produkt: ", product.getName());

		inputField = new TextField("Anzahl eingeben:", "1", 256,
				TextField.NUMERIC);

		this.append(productLabel);
		this.append(inputField);
		this.addCommand(new AddProductCommand(midlet, this, offlineScannedBarcodes));
		this.addCommand(new DeleteProductCommand(midlet, this));
		this.addCommand(new ResumeCommand(midlet));
		midlet.display(this);
	}
	
	public Product getProduct() {
		return product;
	}
	
	public TextField getTextField() {
		return inputField;
	}
}
